﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ServerFrame
{
    public class ObjPool<T>    //泛型
    {
        public Stack<T> pool;

        public ObjPool(int Max) {
            pool = new Stack<T>(Max);
        }

        /// <summary>
        /// 压栈
        /// </summary>
        /// <param name="item"></param>
        public void Push(T item) {
            pool.Push(item);
        }

        /// <summary>
        /// 取栈中元素
        /// </summary>
        public T Pop() {
            return pool.Pop();
        }

        /// <summary>
        /// 获取栈中个数
        /// </summary>
        public int Count {
            get { return pool.Count; }
        }


        public void Clear() {
            pool.Clear();
        }
    }
}
